#include<iostream>
#include<vector>
#include<unordered_map>
class Solution {
public:
    int findSpecialInteger(std::vector<int>& arr) {
        std::unordered_map<int, int> map;
        int n = arr.size();
        int j = n / 4;
        for (int num : arr)
        {
            map[num]++;
            if (map[num] > j)
            {
                return num;
            }
        }
        return -1;
    }
};